import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import DigitView from '../views/DigitView.vue'
import DeliciousView from '../views/DeliciousView.vue'
import HomeDec  from '../views/dec/HomeDec.vue'
import DigitDec from '../views/dec/DigitDec'
import DeliciousDec from '../views/dec/DeliciousDec'
import UserView from '../views/UserView.vue'
import StudyView from '../views/StudyView'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    children:[
      //  动态路由传参没有空格的
       { path: '/homedec/:num',
         name: 'honedec',
         component: HomeDec
        //  component:()=>import('../views/dec/HomeDec.vue')
       }

    ]
   
  },

  {
    path: '/digit',
    name: 'digit',
    component: DigitView,
    children:[
      //  动态路由传参没有空格的
       { path: '/digitdec/:num',
         name: 'digitdec',
         component: DigitDec
       }

    ]

  },

  {
    path: '/delicious',
    name: 'delicious',
    component: DeliciousView,
    children:[
      //  动态路由传参没有空格的
       { path: '/deliciousdec/:num',
         name: 'deliciousdec',
         component: DeliciousDec
       }

    ] 

  },

  {
    path: '/user',
    name:  'user',
   component: UserView

  },
  {
    path: '/study',
    name:  'study',
   component: StudyView

  }

  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
